/**
 * Created by sherr on 2017/4/16.
 */
Btn2={
    Create:function(getWidth,getHeight,context,url){
        var btn={enabled:false};


        var whole=new PIXI.DisplayObjectContainer();
        var bl_clicked=false;

        var frame=new PIXI.Graphics();
        frame.lineStyle(1,0x999999,1);
        frame.moveTo(0,0);
        frame.lineTo(getWidth,0);
        frame.lineTo(getWidth,getHeight);
        frame.lineTo(0,getHeight);
        frame.lineTo(0,0);
        whole.addChild(frame);

        var bg=new PIXI.Graphics();
        bg.beginFill(0xffffff,1);
        bg.drawRect(0,0,getWidth,getHeight);
        whole.addChild(bg);


        var frameBG=new PIXI.Graphics();
        frameBG.beginFill(0x000000,0.6);
        frameBG.drawRect(0,0,getWidth,getHeight);
        // whole.addChild(frameBG);
        frameBG.alpha=1;
        // frameBG.x=-getWidth-1;

        var text= new PIXI.Text(context,{fontFamily : 'Arial', fontSize: 20, fill : 0x000000, align : 'center'});
        text.x=getWidth/2-text.width/2;
        text.y=getHeight/2-text.height/2;
        whole.addChild(text);
        var textHover= new PIXI.Text(context,{fontFamily : 'Arial', fontSize: 20, fill : 0xffffff, align : 'center'});
        textHover.x=getWidth/2-textHover.width/2;
        textHover.y=getHeight/2-textHover.height/2;

        var hideWhole=new PIXI.DisplayObjectContainer();
        hideWhole.addChild(frameBG);
        hideWhole.addChild(textHover);

        var hideWholeMask=new PIXI.Graphics();
        hideWholeMask.beginFill(0x000000,1);
        hideWholeMask.drawRect(0,0,getWidth,getHeight);
        whole.addChild(hideWholeMask);
        hideWholeMask.x=-getWidth-1;
        hideWhole.mask=hideWholeMask;

        whole.addChild(hideWhole);



        bg.interactive=true;
        // btn.enabled=true;
        bg.on("pointerdown",function(){
            if(btn.enabled) {
                if(url=="Close"){
                    document.dispatchEvent(new CustomEvent("CloseNetElementInfo"))
                }
                else{window.open(url);}
            }
        })
        bg.on("pointerover",function(){
            TweenMax.to(hideWholeMask,0.5,{x:0,ease:Cubic.easeOut});
        })
        bg.on("pointerout",function(){
            TweenMax.to(hideWholeMask,0.4,{x:-getWidth-2,ease:Cubic.easeOut});
        })


        btn.RW=function(){
            return whole;
        }

        return btn;
    }
}
